UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UEQxbj41M/ooxBY/fWHGV3OEK8gu/0ByD1FG2o3wZFw=' 
WHERE 
  key_id = 'e7179643c4be5138bdbcaf6c02dd5304e03af98141ed16dd8119f6a53607005a' 
  AND (
    token = 'UEQxbj41M/ooxBY/fWHGV3OEK8gu/0ByD1FG2o3wZFw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046