UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lLvO8M8+sbVzUzHJJLc1/BB51o3awy6aR1NFSNNYMlg=' 
WHERE 
  key_id = '9b3b76275e4669f3f8d02f7b315ef688fc513e25276d3ece2309859122beb497' 
  AND (
    token = 'lLvO8M8+sbVzUzHJJLc1/BB51o3awy6aR1NFSNNYMlg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034