UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '+SX6flN5J+Owrd5ta917f4c7KPfDEXDSRq6Sm2UKfVE='
WHERE
key_id = 'a3324d57bf57e744eec7fc2d559a227180b32d826dd1fb8f54e3a14a1bbf0ebf'
AND (
token = '+SX6flN5J+Owrd5ta917f4c7KPfDEXDSRq6Sm2UKfVE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)