UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'G5Z9qFjPSdk1NszYb6j7R5d/dJR08xaT3mAjzDduzAI='
WHERE
key_id = 'c3be3a6d9f503ee695992c1b03c2f2684a091be9acefe1e8207a234b708aee07'
AND (
token = 'G5Z9qFjPSdk1NszYb6j7R5d/dJR08xaT3mAjzDduzAI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)