UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Qfh8Z1pHaZrTkIapoqY1mDlC40b77FsuhWMI1aRsPUQ='
WHERE
key_id = '7961b935f1497d839ece1a279eab7292e50a77a7ec6efac35561fa8da7bc38fb'
AND (
token = 'Qfh8Z1pHaZrTkIapoqY1mDlC40b77FsuhWMI1aRsPUQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)