UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CUQK2B/L1VGgaXyd8HnRjEFxXlq9NngkwO8oJGCn6GI=' 
WHERE 
  key_id = 'b3b7663fb653119714a9b1b4bfcdc0901f4c60685d04bee819fd0d83e9be5745' 
  AND (
    token = 'CUQK2B/L1VGgaXyd8HnRjEFxXlq9NngkwO8oJGCn6GI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032