UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oi2EINbSzrHM9LYL6jm7rrM7es7LlCmUcXtb6AMJrvc=' 
WHERE 
  key_id = '56b9c8bb2bcac17753222a68cfdc462e24657fd5f7a60901f0c3691859737378' 
  AND (
    token = 'oi2EINbSzrHM9LYL6jm7rrM7es7LlCmUcXtb6AMJrvc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016