UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gnshq0UB01ZDO0HORxg5ENaEZhmRjfohdVV3SpKA8l8=' 
WHERE 
  key_id = '0995c2d35151f81946990a430a0c3426576216f15e35e2714ba499f572d04b77' 
  AND (
    token = 'gnshq0UB01ZDO0HORxg5ENaEZhmRjfohdVV3SpKA8l8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024