UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FeiN/nnZ9KKN+M4hOfusRVU9pf1tozmO4UG6CAF10Uo=' 
WHERE 
  key_id = '522063dc0037e8e0092c7c200abbd41c3a27345e5a0b4fdeb0f6221c8f27c455' 
  AND (
    token = 'FeiN/nnZ9KKN+M4hOfusRVU9pf1tozmO4UG6CAF10Uo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054