UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nBf7ra1XEAwMivatfQMcgd5/ELFsDKIbQ608grormjk=' 
WHERE 
  key_id = 'd128f3e83878ddccefe797e2e603ee4923fd4cf16bc80fdefbbe76a760a31b10' 
  AND (
    token = 'nBf7ra1XEAwMivatfQMcgd5/ELFsDKIbQ608grormjk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028