UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JV1j2VIqlCQQt/0jNNuvFucOqA8E01lheUO9UgIdUL4='
WHERE
key_id = '16b564e3ba34973b9fb94b8a1a52f992b4772029b234039304e79f4b78b0ef2b'
AND (
token = 'JV1j2VIqlCQQt/0jNNuvFucOqA8E01lheUO9UgIdUL4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)