UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FmlvBO5r2ARa+8lp0rt/GfrPASrWXNwqKKEzRdNpOmg=' 
WHERE 
  key_id = 'd8304a72d2832ad33663d1b3e849fa073522db9c67e4c64893a231d6f4c10050' 
  AND (
    token = 'FmlvBO5r2ARa+8lp0rt/GfrPASrWXNwqKKEzRdNpOmg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032