UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oavsYSktoyhBD8/AFaqfx+IO0HqUIv1hagsXgL3iZjI='
WHERE
key_id = 'd0cceddcb8afd54a15eb265c1c971f495fc36b7781de1b95940c622f9ca20915'
AND (
token = 'oavsYSktoyhBD8/AFaqfx+IO0HqUIv1hagsXgL3iZjI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)