UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'j6shxgibG5Zk5Kg2jI6lPg+LiY06uW9fPKZ59npsUVg='
WHERE
key_id = '4c76d7b38a9795847513c1a09d6071fb0230abcd1f849beeeff339965c673310'
AND (
token = 'j6shxgibG5Zk5Kg2jI6lPg+LiY06uW9fPKZ59npsUVg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)