UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ENj2XA3NB9DUJpOIhBXfV3Pj8NtVEkSupvHSBGIxc5s='
WHERE
key_id = '1cacb23f08b54a511487ef73a48b823cbc20651b9ccc8c3138a2a00da083c797'
AND (
token = 'ENj2XA3NB9DUJpOIhBXfV3Pj8NtVEkSupvHSBGIxc5s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)