UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kIRTj9Kucu1wqHXThnKT4L97F2HjaaXAowAANvhiM2U='
WHERE
key_id = 'e297d6f24aed455942e1e26682c5bd9f1c76c930b7425087e4260525fe070f1f'
AND (
token = 'kIRTj9Kucu1wqHXThnKT4L97F2HjaaXAowAANvhiM2U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)