UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bDzHoW3XovdPlW1+DqjYta/5BnkaFahOBO9+KgJLgV0='
WHERE
key_id = 'c0c09d1320be8c93018282816c875bf4a461a9d5338a40e443eba0053c835252'
AND (
token = 'bDzHoW3XovdPlW1+DqjYta/5BnkaFahOBO9+KgJLgV0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)