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

Query time 0.00105