UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aAz0e+Gzyg9grVYIBTtiTNe37of8vW0oW3FB6d1eT3Q='
WHERE
key_id = 'ad790bba6633b54d2a65e9c848fb4615f2b25330ede7277d1ea0773f22fe4160'
AND (
token = 'aAz0e+Gzyg9grVYIBTtiTNe37of8vW0oW3FB6d1eT3Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)