UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JS3syO/jlqkVbdXFsu3cUDC/r2eN3fC84OeVoyeIWYU='
WHERE
key_id = 'ab590aa50ffdabfb1200d9cb01bfc9cf9d802171d56f437e685c6ad5ad8412ef'
AND (
token = 'JS3syO/jlqkVbdXFsu3cUDC/r2eN3fC84OeVoyeIWYU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)