UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MDdZfZajDkN/QV1YuMaPH475CY+lCTGBPT7ev8t+ya8='
WHERE
key_id = 'f9034c9a2014d4fb8ea953dc64ecddd16710956240fa4574be47ca8158d0e35e'
AND (
token = 'MDdZfZajDkN/QV1YuMaPH475CY+lCTGBPT7ev8t+ya8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)