UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'A5NtAntElNrDDqh+aA244GpZQdJRbM1j0E0CuwDYI4c=' 
WHERE 
  key_id = 'e9d8d03053f582cf8df28e71a3f3d475a4e46ac4addecc0b837f48b8bd09df55' 
  AND (
    token = 'A5NtAntElNrDDqh+aA244GpZQdJRbM1j0E0CuwDYI4c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030