UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h18S8HDF6EctbfhUwjYXGt0q+MN7S8v6qgdUp9Im+yg=' 
WHERE 
  key_id = '9c6e2dc36aa70248940b38a4a13bc38157ed4ce580416121c8063dd99d70cc3a' 
  AND (
    token = 'h18S8HDF6EctbfhUwjYXGt0q+MN7S8v6qgdUp9Im+yg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024