UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RV6JgD8OQCFY4Z5J/pCA3207AruDxwRTJXU9yxtDHqo='
WHERE
key_id = '09af506083b83abf8c92dfdf5cf06236ec49af493398c064add46ae182b0f8b9'
AND (
token = 'RV6JgD8OQCFY4Z5J/pCA3207AruDxwRTJXU9yxtDHqo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)