UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NbGGQRizzGG2AyrrCgJn6fItVdkGUrjarUqzhDz5Ksg='
WHERE
key_id = 'ec5f0a04bf4e52a539d5a7ea578de6cd23063af0cef79560e273951810ce6260'
AND (
token = 'NbGGQRizzGG2AyrrCgJn6fItVdkGUrjarUqzhDz5Ksg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)