UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'elVMRqDWzDdd47zgdX29CTrf2VRrAviZuGnbY5lcdPA=' 
WHERE 
  key_id = '2b88c2f2e699b7427dae7a0c60cede3924bda1b8b792158ee1eec99e19e3c1f8' 
  AND (
    token = 'elVMRqDWzDdd47zgdX29CTrf2VRrAviZuGnbY5lcdPA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026