UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'B/kaCKREu2d59putWeEXQvU3lSk3Cv+ALu2DJmtWJTA='
WHERE
key_id = 'ac7d12fe3276c0f2b150f895d19d19a9879f7d07f8999806ed4c041b9cb69403'
AND (
token = 'B/kaCKREu2d59putWeEXQvU3lSk3Cv+ALu2DJmtWJTA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)