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